<%@page contentType="text/html;charset=utf-8" %>
<%@taglib prefix="s" uri="/struts-tags" %>   
<script type="text/javascript">
function mg_savesdkproviders(type)
{
    if (!confirm("确定继续？"))
    {
        return false;
    }
    var url = "mg/sdkconfig/save.do?type=" + type;
    var objectid = "mg_sdkproviders";
    postXMLHttpRequest(url, "myform", objectid); 
}
function mg_sdkconfigoperatornameonchange(obj)
{
	var va = obj.value;
	var objname = "";
	if(va=="UNICOM")
	{
		objname = "unicomprovince";
	}
	else if(va=="CMCC")
	{
		objname = "cmccprovince";
	}
	else if(va=="TELECOM")
	{
		objname = "telecomprovince";
	}
	var objs = document.getElementsByName(objname); 
	for(i = 0; i < objs.length; i++) 
	{ 
		if(obj.checked) 
		{ 
			objs[i].checked = true; 
		}
		else
		{
			objs[i].checked = false; 
		}
	} 
}
</script>
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="5"></td>
    <td>   
  <form id="myform" name="myform"
        method="post" action="">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td colspan="3">
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/table_top_left.jpg" width="20" height="15" /></td>
            <td><img src="images/table_top_bg.jpg" width="770" height="15"/></td>
            <td align="right">
              <img src="images/table_top_right.jpg" width="20" height="15" /></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td height="25" colspan="3" class="table_blue">
        <strong><img src="images/dot.jpg" width="13" height="9">SDK资源管理</strong>
         <input type="hidden" id="model.id" name="model.id"  value="<s:property value="model.id" />" />
         <input type="hidden" id="model.sdkprovidersid" name="model.sdkprovidersid"  value="<s:property value="model.sdkprovidersid" />" />
        <input type="hidden" id="model.createuser" name="model.createuser"  value="<s:property value="model.createuser" />" />
        <input type="hidden" id="model.createdate" name="model.createdate"  value="<s:property value="model.createdate" />" />
        </td>
    </tr> 
    <tr>
      <td class="table_w1" align="center" width="20%" rowspan="3">&nbsp;<font color="red">(*)</font>开通情况：</td>
      <td class="table_w2"  width="10%">&nbsp;
      	<input type="checkbox" id="operatorname" name="operatorname" value="CMCC"
      	 <s:if test="(','+model.operator+',').indexOf(',CMCC,')!=-1">checked</s:if> 
      	 onclick="mg_sdkconfigoperatornameonchange(this)"/>移动
      </td>
      <td class="table_w2">
      	  <s:iterator value="%{getProvinces()}" status="stat">
	        <s:if test="#stat.index>0&&#stat.index%9==0"></br></s:if>
	        &nbsp;<input type="checkbox"
	        <s:if test="(','+model.cmccprovince+',').indexOf(','+code+',')!=-1">checked</s:if> 
	        name="cmccprovince" id="cmccprovince" value="<s:property value="code" />">&nbsp;<s:property value="name" />
	        </s:iterator>  
      </td>
    </tr>
     <tr>
      <td class="table_w2" width="10%">&nbsp;
        <input type="checkbox" id="operatorname" name="operatorname" value="UNICOM" <s:if test="(','+model.operator+',').indexOf(',UNICOM,')!=-1">checked</s:if>
         onclick="mg_sdkconfigoperatornameonchange(this)"/>联通</td>
      <td class="table_w2">
      		<s:iterator value="%{getProvinces()}" status="stat">
	        <s:if test="#stat.index>0&&#stat.index%9==0"></br></s:if>
	        &nbsp;<input type="checkbox" 
	        <s:if test="(','+model.unicomprovince+',').indexOf(','+code+',')!=-1">checked</s:if> 
	        name="unicomprovince" id="unicomprovince" value="<s:property value="code" />">&nbsp;<s:property value="name" />
	        </s:iterator>  
      </td>
    </tr>
     <tr>
      <td class="table_w2" width="10%">&nbsp;
        <input type="checkbox" id="operatorname" name="operatorname" value="TELECOM" <s:if test="(','+model.operator+',').indexOf(',TELECOM,')!=-1">checked</s:if> 
        onclick="mg_sdkconfigoperatornameonchange(this)"/>电信</td>
      <td class="table_w2">
      		<s:iterator value="%{getProvinces()}" status="stat">
	        <s:if test="#stat.index>0&&#stat.index%9==0"></br></s:if>
	        &nbsp;<input type="checkbox" 
	        <s:if test="(','+model.telecomprovince+',').indexOf(','+code+',')!=-1">checked</s:if> 
	        name="telecomprovince" id="telecomprovince" value="<s:property value="code" />">&nbsp;<s:property value="name" />
	        </s:iterator>  
      </td>
    </tr>
    
    
    <tr>
      <td class="table_w1" align="center" width="20%" rowspan="3">&nbsp;<font color="red">(*)</font>开通资费：</td>
      <td class="table_w2"  width="10%">&nbsp;
      	<input type="radio" id="feetype" name="feetype" value="0" <s:if test="model.feetype==0">checked</s:if>/>不限资费
      </td>
      <td class="table_w2">&nbsp;</td>
    </tr>
     <tr>
      <td class="table_w2" width="10%">&nbsp;
        <input type="radio" id="feetype" name="feetype" value="1" <s:if test="model.feetype==1">checked</s:if>/>上限
	  </td>
      <td class="table_w2">
      		<input type = "text" id="model.feeceiling" name="model.feeceiling" value="<s:property value="model.feeceiling" />"/>
      </td>
    </tr>
     <tr>
      <td class="table_w2" width="10%">&nbsp;
        <input type="radio" id="feetype" name="feetype" value="2" <s:if test="model.feetype==2">checked</s:if>/>指定资费</br>
        	&nbsp;单位（元）
      </td>
      <td class="table_w2">
      		<s:iterator value="new int[30]" status="stat">
	        <s:if test="#stat.index>0&&#stat.index%9==0"></br></s:if>
	        <s:set name="value1" value="#stat.index+1" />
	        &nbsp;<input type="checkbox" 
	        <s:if test="(','+model.appointfee+',').indexOf(','+(#value1)+',')!=-1">checked</s:if> 
	        name="appointfee" id="appointfee" value="<s:property value="#stat.index+1"/>">&nbsp;<s:property value="#stat.index+1"/>
	        </s:iterator>  
      </td>
    </tr>
    <tr>
      <td colspan="3" class="table_w1" align="center">
        <s:if test="type.equals('insert')" >
        <button id="btn2" dojoType="dijit.form.Button"
            onclick="mg_savesdkproviders('insert');">添加</button>
        </s:if>
        <s:else>
        <button id="btn2" dojoType="dijit.form.Button"
            onclick="mg_savesdkproviders('update');">修改</button>
        &nbsp;&nbsp;        
        <button id="btn3" dojoType="dijit.form.Button"
            onclick="mg_savesdkproviders('delete');">删除</button>
        </s:else>
      </td>      
    </tr>
    <tr> 
      <td colspan="3" background="images/table_bom_bg.jpg">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="images/table_bom_left.jpg" width="20" height="15"></td>
          <td></td>
          <td align="right">
            <img src="images/table_bom_right.jpg" width="20" height="15"></td>
        </tr>
        </table>
      </td>
    </tr>
  </table>  
  </form>
  </td>
  <td width="5"></td>
  </tr>
  </table>